import { ExampleCode } from '@/components/Example';

## Unauthenticated Routes

Providing a builder value of `Authenticator.builder()` to your MaterialApp will make all routes in your application require authentication. The Authenticator can also be used to protect a subset of routes, and leave other routes unauthenticated.

In the example below, the default route (`/`) will not require authentication. When the app launches, the HomeScreen widget will show to authenticated and unauthenticated users. `/profile` returns an AuthenticatedView widget, with a child of `ProfileScreen()`. This route will require authentication. If an unauthenticated user navigates to this route, they will see the authenticator. As soon as they authenticate, they will see the ProfileScreen widget.

<ExampleCode>
  ```dart file=../../../../../../flutter/authenticator/lib/examples/routing/navigator_1.dart
  ```
</ExampleCode>

`AuthenticatedView` can be used along side the routing package of your choice. The example shows the same example using go_router.

<ExampleCode>
  ```dart file=../../../../../../flutter/authenticator/lib/examples/routing/go_router.dart
  ```
</ExampleCode>
